#ifndef FORM_H
#define FORM_H

#include <QWidget>
#include <QAudioDeviceInfo>
#include <QAudioInput>
#include <QAudioOutput>
#include <QTcpSocket>

#include "sendaudio.h"
#include "soundserver.h"
#include "resizeui.h"
#include <QResizeEvent>

#define TCPPORT 10023
#define CLIENT_SEND_PORT 10024
#define CLIENT_RECV_PORT 10025
#define SERVER_SEND_PORT 10026
#define SERVER_RECV_PORT 10027

namespace Ui {
class Form;
}

class Form : public QWidget
{
    Q_OBJECT

public:
    explicit Form(QWidget *parent = 0);
    ~Form();

    void resizeEvent(QResizeEvent *event);

    void init(QTcpSocket *socket, SendAudio *sendA, SoundServer *soundS, QString ip){
        tcpSocket=socket;
        clientSend=sendA;
        soundServer=soundS;
        dstIP=ip;
    }

private slots:
    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_6_clicked();

private:
    Ui::Form *ui;
    ResizeUI resizeUi;

    QList<QAudioDeviceInfo> inputDevs;

    QTcpSocket *tcpSocket;
    bool isSending=false;

    SendAudio *clientSend;
    SoundServer *soundServer;
    QString dstIP;

    int serverSendDelay=3;
};

#endif // FORM_H
